package com.source.hotelbath.base;

import android.view.View;
import android.widget.BaseAdapter;

/**
 * materail view在有拦截ontouch时间导致abslistview中onitemclick 被拦截不能使用
 * 如果这里写一个adapter做处理
 */
public abstract class CustomerAdapter extends BaseAdapter {

    private OnItemClickListener mOnItemClickListener;
    private OnItemLongClickListener mOnItemLongClickListener;

    public void onItemClick(int position, View convertView) {
        if (null != mOnItemClickListener) {
            mOnItemClickListener.itemClick(position, convertView);
        }
    }

    public void onItemLongClick(int position, View convertView) {
        if (null != mOnItemLongClickListener) {
            mOnItemLongClickListener.itemlongClick(position, convertView);
        }
    }

    public interface OnItemClickListener {
        public void itemClick(int position, View contentView);
    }


    public interface OnItemLongClickListener {
        public void itemlongClick(int position, View contentView);
    }

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        this.mOnItemClickListener = onItemClickListener;
    }

    public void setOnItemlongClickListener(OnItemLongClickListener onItemlongClickListener) {
        this.mOnItemLongClickListener = onItemlongClickListener;
    }
}
